package test04;

public class Tickets extends Thread {

    public static int tickets = 100;

    @Override
    public void run() {
        while(true){
            if(tickets <= 0){
                break;
            }else{
                try {
                    //线程睡眠5秒
                    Thread.sleep(5);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println(getName() + "第" + tickets-- + "张");
        }
    }
}
